#ifndef FILEFRAME_H
#define FILEFRAME_H

#include <QWidget>
//#include <QTreeWidget>
//#include <QItemDelegate>


class FileListView;
class ConvertEntryView;
class QLabel;
class FileFrame : public QWidget
{
    Q_OBJECT
public:
    explicit FileFrame(QWidget *parent = 0);
    void addFileList(const QStringList &filelist);
    void addDirectory(const QString &path);
    void deleteSelectedFiles();

signals:
    void signalLanguageChanged();
    void signalFileSelectionChanged(bool,bool);

public slots:

protected:


private:
    void initUI();
    QLabel *createBglabel(const QString &imgpath);
    FileListView *m_fileView;
    ConvertEntryView *m_convertEntryView;
};

/*
class fileView : public QTreeWidget
{
    Q_OBJECT
public:
    fileView(QWidget *parent = 0);

signals:
    void fileDropped(const QString &fileName);

protected:
    void dragMoveEvent(QDragMoveEvent *event);
    void dropEvent(QDropEvent *event);
};


class fileViewDelegate : public QItemDelegate
{
    Q_OBJECT
public:
    inline fileViewDelegate(FileFrame *mainWindow) : QItemDelegate(mainWindow) {}

    inline void paint(QPainter *painter, const QStyleOptionViewItem &option,
                      const QModelIndex &index ) const
    {
        if (index.column() != 4) {
            QItemDelegate::paint(painter, option, index);
            return;
        }

        // Set up a QStyleOptionProgressBar to precisely mimic the
        // environment of a progress bar.
        QStyleOptionProgressBar progressBarOption;
        progressBarOption.state = QStyle::State_Enabled;
        progressBarOption.direction = QApplication::layoutDirection();
        progressBarOption.rect = option.rect;
        progressBarOption.fontMetrics = QApplication::fontMetrics();
        progressBarOption.minimum = 0;
        progressBarOption.maximum = 100;
        progressBarOption.textAlignment = Qt::AlignCenter;
        progressBarOption.textVisible = true;
#if 0
        // Set the progress and text values of the style option.
        int progress = qobject_cast<FileFrame *>(parent())->clientForRow(index.row())->progress();
        progressBarOption.progress = progress < 0 ? 0 : progress;
        progressBarOption.text = QString().sprintf("%d%%", progressBarOption.progress);
#endif
        // Draw the progress bar onto the view.
        QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter);
    }
};

*/
#endif // FILEFRAME_H
